﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Sinacor.Infra.Service.Data;
using System.Data.Common;
using System.Data;

namespace Sinacor.OMM.OrderExecutor.ResourceAccess
{
    public class OrderExecutor:BaseResourceAccess
    {
        public OrderExecutor(Int32 companyID) 
            : base(companyID)
        {

        }

        /// <summary>
        /// Execute process order
        /// </summary>
        public int ExecuteProcessOrder()
        {
            string sql = string.Empty;

            using (DbCommand command = this.DataBase.GetStoredProcCommand("PR_OFMEGA.OFERTA380_HUB"))
            {
                this.DataBase.AddOutParameter(command, "R_nCtrlRec", DbType.Int32, 9);
                this.DataBase.AddOutParameter(command, "R_nReproc", DbType.Int32, 9);
                this.DataBase.ExecuteNonQuery(command);

                long i = Convert.ToInt64(this.DataBase.GetParameterValue(command, "R_nCtrlRec"));
                int i2 = Convert.ToInt32(this.DataBase.GetParameterValue(command, "R_nReproc"));
                return i2;
            }

        }
    }
}
